package com.songlanyun.modules.information.controller.api;

import com.songlanyun.common.utils.R;
import com.songlanyun.modules.information.entity.InformationClassifyEntity;
import com.songlanyun.modules.information.service.InformationClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 资讯分类
 *
 * @author WuChao
 * @email songlanyun@gmail.com
 * @date 2022-11-18 09:52:58
 */
@RestController
@RequestMapping("api/information/classify")
public class InformationClassifyApiController {
    @Autowired
    private InformationClassifyService informationClassifyService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list() {
        List<InformationClassifyEntity> list = informationClassifyService.lambdaQuery()
                .orderByAsc(InformationClassifyEntity::getSort)
                .orderByDesc(InformationClassifyEntity::getCreateTime)
                .list();
        return R.ok().put("list", list);
    }

}
